package com.job;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;

import java.util.Map;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-04-19.
 *
 * @author chouFy
 */
public class BackupJob implements SimpleJob {

    @Override
    public void execute(ShardingContext shardingContext) {

        TestDao testDao = new TestDao();

        Map<String, Object> data = testDao.getData();
        if (data == null) {
            return;
        }

        long id = (long) data.get("id");
        String name = (String) data.get("name");
        String education = (String) data.get("education");
        System.out.println("id:" + id + " name:" + name + ", education:" + education);

        testDao.update(id);

        testDao.backData(id);
    }
}
